<?php

declare(strict_types=1);
/**
 * This file is part of habo_new_media.
 *
 * @link     https://www.berlen.cn/
 * @contact  tech@berlen.cn
 * @license  http://gitlab.rehou.cn/habo/habo_new_media/-/blob/master/README.md
 */
namespace app\service\analysis;

use app\enum\AnalysisEnum;
use app\enum\CommonEnum;
use app\model\KsAdvertiserModel;

trait KuaiShouTrait
{
    /**
     * @var int 媒体ID
     */
    protected static int $mediaId = CommonEnum::KS_MEDIA;

    /**
     * @var string 表前缀
     */
    protected static string $tablePrefix = AnalysisEnum::KS_TABLE_PREFIX;

    /**
     * 获取客户userid.
     *
     * @param string $advId 账户id
     * @return mixed|string
     */
    protected static function getUserId(string $advId = '')
    {
        $obj = (new KsAdvertiserModel())->where('advertiser_id', $advId)->findOrEmpty();
        return $obj->getAttr('user_id') ?: '';
    }
}
